package com.zelo.blog.server.security;

import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.Date;

@Data
@NoArgsConstructor
@ToString
public class AuthenticationUser implements UserDetails {
    private String                                 username;
    private String                                 password;
    private String                                 email;
    private Boolean                                gender;
    private Integer                                age;
    private String                                 idCard;
    private Date                                   expireDate;
    private String                                 token;
    private Collection<? extends GrantedAuthority> roles;

    public AuthenticationUser(String username, String password, String email, Boolean gender, Integer age, String idCard, Date expireDate, String token, Collection<? extends GrantedAuthority> roles) {
        this.username = username;
        this.password = password;
        this.email = email;
        this.gender = gender;
        this.age = age;
        this.idCard = idCard;
        this.expireDate = expireDate;
        this.token = token;
        this.roles = roles;
    }

    @Override
    public boolean isAccountNonExpired() {
        return false;
    }

    @Override
    public boolean isAccountNonLocked() {
        return false;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return false;
    }

    @Override
    public boolean isEnabled() {
        return false;
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return roles;
    }

    @Override
    public String getPassword() {
        return null;
    }
}
